<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <title>Editor</title>
  <style type="text/css" media="screen">
    body {
        overflow: hidden;
	font-family: monospace;
    }

    #editor {
        margin: 0;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
	font-family: monospace;
	font-size: 10pt;
    }
  </style>
</head>
<body>

<pre id="editor">
</pre>

<script src="ace/ace.js" type="text/javascript" charset="utf-8"></script>
<script>
    var editor = ace.edit("editor");
    editor.setTheme("ace/theme/twilight");
    editor.getSession().setMode("ace/mode/javascript");
    editor.getSession().on('change', function(e) {
      JSBridge.UpdateFileContents(editor.getSession().getValue());
      //console.log(editor.getSession().getValue());
    });
    function SetContents(enc) {
      editor.getSession().setValue(atob(enc));
    }

    function GetCursorPos() {
      JSBridge.SetCursorPos(editor.getCursorPosition().column,editor.getCursorPosition().row);
    }
    
    function SearchFor(t) {
      return editor.findAll(t,{
        backwards: false,
        wrap: false,
        caseSensitive: false,
        wholeWord: false,
        regExp: false
      },false);
    }
</script>
</body>
</html>
